package net.example.model;

import com.oraycn.omcs.utils.BufferUtils;

/**
 * 用户状态 （正常，冻结，禁言，停用）
 * */
public enum UserState
{
    /**
     * 正常
     * */
    Normal,

    /**
     * 冻结
     * */
    Frozen,

    /**
     * 禁言
     * */
    NoSpeaking,

    /**
     * 停用
     * */
    StopUsing;

    public static UserState getUserStateByCode(int code) {
        for (UserState type : UserState.values()) {
            if (type.ordinal() == code) {
                return type;
            }
        }
        return null;
    }

    public static byte[] GetUserStateBytes(UserState userState) {
        return BufferUtils.newBuffer(4).writeInt(userState.ordinal()).array();
    }
}


